from requests.utils import default_headers

from core.api_util import api_util
from utils.response_util import process_response


def send_code(json_data):
    """
    获取短信验证码
    :param json_data:
    :return:
    """
    response = api_util.get_code(json=json_data)
    return process_response(response)


def login(username, password, logintype, orgid, version, needrandomorg, headers=default_headers):
    """
    登录接口
    :param mobile:
    :return:
    """
    default_headers={
        "Content-Type": "application/json",
        "tenantId":"889522550256967680"
    }
    json_data = {
        "userName": username,
        "password": password,
        "loginType": logintype,
        "orgId": orgid,
        "version": version,
        "needRandomOrg": needrandomorg
    }
    response = api_util.user_login(json=json_data, headers=default_headers)
    return process_response(response)
